package com.zhss.concurrency.subject;

import java.util.HashMap;
import java.util.Map;

/**
 * @ClassName SmsRoute
 * @Description TODO
 * @Author leejiliang
 * @DateTime 2021/8/31 14:52
 * @Version 1.0
 */
public class SmsRouter {
	private static volatile SmsRouter instance = new SmsRouter();

	private final Map<Integer, SmsInfo> smsInfoMap;

	public SmsRouter() {
		this.smsInfoMap=loadSmsInfoFromDB();
	}

	private Map<Integer, SmsInfo> loadSmsInfoFromDB() {
		Map<Integer, SmsInfo> integerSmsInfoHashMap = new HashMap<>();
		integerSmsInfoHashMap.put(1, new SmsInfo("www.sss.xx", 100L));
		integerSmsInfoHashMap.put(2, new SmsInfo("www.sss.yy", 101L));
		integerSmsInfoHashMap.put(3, new SmsInfo("www.sss.zz", 102L));
		return integerSmsInfoHashMap;
	}

	public static SmsRouter getInstance() {
		return instance;
	}

	public Map<Integer, SmsInfo> getSmsInfoMap() {
		return smsInfoMap;
	}
}
